/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.sapra.dep;

import com.mysql.jdbc.Connection;
import com.mysql.jdbc.Statement;
import java.sql.DriverManager;
import org.sapra.dep.conexion.DAC;


/**
 *
 * @author BlackCrystal™
 */
public class EmpresaMO extends DAC{
    public EmpresaMO(){

    }
    public EmpresaMO(int id){
            this.empresaId=id;
            persistence();
    }

    private int empresaId=0;
    private String razonEmpresa="";
    private int fk_bancoId=0;
    private String razon_factura="";


     private void persistence(){
        String sql="";
        try {
            Class.forName("com.mysql.jdbc.Driver").newInstance();
            conn = (Connection) DriverManager.getConnection(url);
            stmt = (Statement) conn.createStatement();
            sql="SELECT * FROM empresa WHERE empresaId="+this.empresaId;
            rs=stmt.executeQuery(sql);
            while(rs.next()){
                this.razonEmpresa=rs.getString("razon_empresa");
                this.fk_bancoId=rs.getInt("fk_bancoId");
                this.razon_factura=rs.getString("razon_factura");
              }
                 CloseConnexion();
         } catch (Exception e) {
             System.out.println("Error en carga de Gpo Corporativo");
             CloseConnexion();
         }finally{
            CloseConnexion();
         }
    }





    public int getEmpresaId() {
        return empresaId;
    }

    public void setEmpresaId(int empresaId) {
        this.empresaId = empresaId;
    }

    public String getRazonEmpresa() {
        return razonEmpresa;
    }

    public void setRazonEmpresa(String razonEmpresa) {
        this.razonEmpresa = razonEmpresa;
    }

    public int getFk_bancoId() {
        return fk_bancoId;
    }

    public void setFk_bancoId(int fk_bancoId) {
        this.fk_bancoId = fk_bancoId;
    }

    public String getRazon_factura() {
        return razon_factura;
    }

    public void setRazon_factura(String razon_factura) {
        this.razon_factura = razon_factura;
    }

    


}
